/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class List
    {
    
        private String listIdField;

        private String listURLField;

        private String registryNumberField;

        private String listNameField;

        private String listTypeField;

        private Decimal? totalItemsField;

        private Decimal? totalPagesField;

        private String dateCreatedField;

        private String occasionDateField;

        private String customerNameField;

        private String partnerNameField;

        private String additionalNameField;

        private String commentField;

        private  Image imageField;
        private Decimal? averageRatingField;

        private Decimal? totalVotesField;

        private Decimal? totalTimesReadField;

        private  Tags tagsField;

        /// <summary>
        /// Gets and sets the ListId property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ListId")]
        public String ListId
        {
            get { return this.listIdField ; }
            set { this.listIdField= value; }
        }



        /// <summary>
        /// Sets the ListId property
        /// </summary>
        /// <param name="listId">ListId property</param>
        /// <returns>this instance</returns>
        public List WithListId(String listId)
        {
            this.listIdField = listId;
            return this;
        }



        /// <summary>
        /// Checks if ListId property is set
        /// </summary>
        /// <returns>true if ListId property is set</returns>
        public Boolean IsSetListId()
        {
            return  this.listIdField != null;

        }


        /// <summary>
        /// Gets and sets the ListURL property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ListURL")]
        public String ListURL
        {
            get { return this.listURLField ; }
            set { this.listURLField= value; }
        }



        /// <summary>
        /// Sets the ListURL property
        /// </summary>
        /// <param name="listURL">ListURL property</param>
        /// <returns>this instance</returns>
        public List WithListURL(String listURL)
        {
            this.listURLField = listURL;
            return this;
        }



        /// <summary>
        /// Checks if ListURL property is set
        /// </summary>
        /// <returns>true if ListURL property is set</returns>
        public Boolean IsSetListURL()
        {
            return  this.listURLField != null;

        }


        /// <summary>
        /// Gets and sets the RegistryNumber property.
        /// </summary>
        [XmlElementAttribute(ElementName = "RegistryNumber")]
        public String RegistryNumber
        {
            get { return this.registryNumberField ; }
            set { this.registryNumberField= value; }
        }



        /// <summary>
        /// Sets the RegistryNumber property
        /// </summary>
        /// <param name="registryNumber">RegistryNumber property</param>
        /// <returns>this instance</returns>
        public List WithRegistryNumber(String registryNumber)
        {
            this.registryNumberField = registryNumber;
            return this;
        }



        /// <summary>
        /// Checks if RegistryNumber property is set
        /// </summary>
        /// <returns>true if RegistryNumber property is set</returns>
        public Boolean IsSetRegistryNumber()
        {
            return  this.registryNumberField != null;

        }


        /// <summary>
        /// Gets and sets the ListName property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ListName")]
        public String ListName
        {
            get { return this.listNameField ; }
            set { this.listNameField= value; }
        }



        /// <summary>
        /// Sets the ListName property
        /// </summary>
        /// <param name="listName">ListName property</param>
        /// <returns>this instance</returns>
        public List WithListName(String listName)
        {
            this.listNameField = listName;
            return this;
        }



        /// <summary>
        /// Checks if ListName property is set
        /// </summary>
        /// <returns>true if ListName property is set</returns>
        public Boolean IsSetListName()
        {
            return  this.listNameField != null;

        }


        /// <summary>
        /// Gets and sets the ListType property.
        /// </summary>
        [XmlElementAttribute(ElementName = "ListType")]
        public String ListType
        {
            get { return this.listTypeField ; }
            set { this.listTypeField= value; }
        }



        /// <summary>
        /// Sets the ListType property
        /// </summary>
        /// <param name="listType">ListType property</param>
        /// <returns>this instance</returns>
        public List WithListType(String listType)
        {
            this.listTypeField = listType;
            return this;
        }



        /// <summary>
        /// Checks if ListType property is set
        /// </summary>
        /// <returns>true if ListType property is set</returns>
        public Boolean IsSetListType()
        {
            return this.listTypeField != null;

        }


        /// <summary>
        /// Gets and sets the TotalItems property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalItems")]
        public Decimal TotalItems
        {
            get { return this.totalItemsField.GetValueOrDefault() ; }
            set { this.totalItemsField= value; }
        }



        /// <summary>
        /// Sets the TotalItems property
        /// </summary>
        /// <param name="totalItems">TotalItems property</param>
        /// <returns>this instance</returns>
        public List WithTotalItems(Decimal totalItems)
        {
            this.totalItemsField = totalItems;
            return this;
        }



        /// <summary>
        /// Checks if TotalItems property is set
        /// </summary>
        /// <returns>true if TotalItems property is set</returns>
        public Boolean IsSetTotalItems()
        {
            return  this.totalItemsField != null;

        }


        /// <summary>
        /// Gets and sets the TotalPages property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalPages")]
        public Decimal TotalPages
        {
            get { return this.totalPagesField.GetValueOrDefault() ; }
            set { this.totalPagesField= value; }
        }



        /// <summary>
        /// Sets the TotalPages property
        /// </summary>
        /// <param name="totalPages">TotalPages property</param>
        /// <returns>this instance</returns>
        public List WithTotalPages(Decimal totalPages)
        {
            this.totalPagesField = totalPages;
            return this;
        }



        /// <summary>
        /// Checks if TotalPages property is set
        /// </summary>
        /// <returns>true if TotalPages property is set</returns>
        public Boolean IsSetTotalPages()
        {
            return  this.totalPagesField != null;

        }


        /// <summary>
        /// Gets and sets the DateCreated property.
        /// </summary>
        [XmlElementAttribute(ElementName = "DateCreated")]
        public String DateCreated
        {
            get { return this.dateCreatedField ; }
            set { this.dateCreatedField= value; }
        }



        /// <summary>
        /// Sets the DateCreated property
        /// </summary>
        /// <param name="dateCreated">DateCreated property</param>
        /// <returns>this instance</returns>
        public List WithDateCreated(String dateCreated)
        {
            this.dateCreatedField = dateCreated;
            return this;
        }



        /// <summary>
        /// Checks if DateCreated property is set
        /// </summary>
        /// <returns>true if DateCreated property is set</returns>
        public Boolean IsSetDateCreated()
        {
            return  this.dateCreatedField != null;

        }


        /// <summary>
        /// Gets and sets the OccasionDate property.
        /// </summary>
        [XmlElementAttribute(ElementName = "OccasionDate")]
        public String OccasionDate
        {
            get { return this.occasionDateField ; }
            set { this.occasionDateField= value; }
        }



        /// <summary>
        /// Sets the OccasionDate property
        /// </summary>
        /// <param name="occasionDate">OccasionDate property</param>
        /// <returns>this instance</returns>
        public List WithOccasionDate(String occasionDate)
        {
            this.occasionDateField = occasionDate;
            return this;
        }



        /// <summary>
        /// Checks if OccasionDate property is set
        /// </summary>
        /// <returns>true if OccasionDate property is set</returns>
        public Boolean IsSetOccasionDate()
        {
            return  this.occasionDateField != null;

        }


        /// <summary>
        /// Gets and sets the CustomerName property.
        /// </summary>
        [XmlElementAttribute(ElementName = "CustomerName")]
        public String CustomerName
        {
            get { return this.customerNameField ; }
            set { this.customerNameField= value; }
        }



        /// <summary>
        /// Sets the CustomerName property
        /// </summary>
        /// <param name="customerName">CustomerName property</param>
        /// <returns>this instance</returns>
        public List WithCustomerName(String customerName)
        {
            this.customerNameField = customerName;
            return this;
        }



        /// <summary>
        /// Checks if CustomerName property is set
        /// </summary>
        /// <returns>true if CustomerName property is set</returns>
        public Boolean IsSetCustomerName()
        {
            return  this.customerNameField != null;

        }


        /// <summary>
        /// Gets and sets the PartnerName property.
        /// </summary>
        [XmlElementAttribute(ElementName = "PartnerName")]
        public String PartnerName
        {
            get { return this.partnerNameField ; }
            set { this.partnerNameField= value; }
        }



        /// <summary>
        /// Sets the PartnerName property
        /// </summary>
        /// <param name="partnerName">PartnerName property</param>
        /// <returns>this instance</returns>
        public List WithPartnerName(String partnerName)
        {
            this.partnerNameField = partnerName;
            return this;
        }



        /// <summary>
        /// Checks if PartnerName property is set
        /// </summary>
        /// <returns>true if PartnerName property is set</returns>
        public Boolean IsSetPartnerName()
        {
            return  this.partnerNameField != null;

        }


        /// <summary>
        /// Gets and sets the AdditionalName property.
        /// </summary>
        [XmlElementAttribute(ElementName = "AdditionalName")]
        public String AdditionalName
        {
            get { return this.additionalNameField ; }
            set { this.additionalNameField= value; }
        }



        /// <summary>
        /// Sets the AdditionalName property
        /// </summary>
        /// <param name="additionalName">AdditionalName property</param>
        /// <returns>this instance</returns>
        public List WithAdditionalName(String additionalName)
        {
            this.additionalNameField = additionalName;
            return this;
        }



        /// <summary>
        /// Checks if AdditionalName property is set
        /// </summary>
        /// <returns>true if AdditionalName property is set</returns>
        public Boolean IsSetAdditionalName()
        {
            return  this.additionalNameField != null;

        }


        /// <summary>
        /// Gets and sets the Comment property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Comment")]
        public String Comment
        {
            get { return this.commentField ; }
            set { this.commentField= value; }
        }



        /// <summary>
        /// Sets the Comment property
        /// </summary>
        /// <param name="comment">Comment property</param>
        /// <returns>this instance</returns>
        public List WithComment(String comment)
        {
            this.commentField = comment;
            return this;
        }



        /// <summary>
        /// Checks if Comment property is set
        /// </summary>
        /// <returns>true if Comment property is set</returns>
        public Boolean IsSetComment()
        {
            return  this.commentField != null;

        }


        /// <summary>
        /// Gets and sets the Image property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Image")]
        public Image Image
        {
            get { return this.imageField ; }
            set { this.imageField = value; }
        }



        /// <summary>
        /// Sets the Image property
        /// </summary>
        /// <param name="image">Image property</param>
        /// <returns>this instance</returns>
        public List WithImage(Image image)
        {
            this.imageField = image;
            return this;
        }



        /// <summary>
        /// Checks if Image property is set
        /// </summary>
        /// <returns>true if Image property is set</returns>
        public Boolean IsSetImage()
        {
            return this.imageField != null;
        }




        /// <summary>
        /// Gets and sets the AverageRating property.
        /// </summary>
        [XmlElementAttribute(ElementName = "AverageRating")]
        public Decimal AverageRating
        {
            get { return this.averageRatingField.GetValueOrDefault() ; }
            set { this.averageRatingField= value; }
        }



        /// <summary>
        /// Sets the AverageRating property
        /// </summary>
        /// <param name="averageRating">AverageRating property</param>
        /// <returns>this instance</returns>
        public List WithAverageRating(Decimal averageRating)
        {
            this.averageRatingField = averageRating;
            return this;
        }



        /// <summary>
        /// Checks if AverageRating property is set
        /// </summary>
        /// <returns>true if AverageRating property is set</returns>
        public Boolean IsSetAverageRating()
        {
            return  this.averageRatingField != null;

        }


        /// <summary>
        /// Gets and sets the TotalVotes property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalVotes")]
        public Decimal TotalVotes
        {
            get { return this.totalVotesField.GetValueOrDefault() ; }
            set { this.totalVotesField= value; }
        }



        /// <summary>
        /// Sets the TotalVotes property
        /// </summary>
        /// <param name="totalVotes">TotalVotes property</param>
        /// <returns>this instance</returns>
        public List WithTotalVotes(Decimal totalVotes)
        {
            this.totalVotesField = totalVotes;
            return this;
        }



        /// <summary>
        /// Checks if TotalVotes property is set
        /// </summary>
        /// <returns>true if TotalVotes property is set</returns>
        public Boolean IsSetTotalVotes()
        {
            return  this.totalVotesField != null;

        }


        /// <summary>
        /// Gets and sets the TotalTimesRead property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalTimesRead")]
        public Decimal TotalTimesRead
        {
            get { return this.totalTimesReadField.GetValueOrDefault() ; }
            set { this.totalTimesReadField= value; }
        }



        /// <summary>
        /// Sets the TotalTimesRead property
        /// </summary>
        /// <param name="totalTimesRead">TotalTimesRead property</param>
        /// <returns>this instance</returns>
        public List WithTotalTimesRead(Decimal totalTimesRead)
        {
            this.totalTimesReadField = totalTimesRead;
            return this;
        }



        /// <summary>
        /// Checks if TotalTimesRead property is set
        /// </summary>
        /// <returns>true if TotalTimesRead property is set</returns>
        public Boolean IsSetTotalTimesRead()
        {
            return  this.totalTimesReadField != null;

        }


        /// <summary>
        /// Gets and sets the Tags property.
        /// </summary>
        [XmlElementAttribute(ElementName = "Tags")]
        public Tags Tags
        {
            get { return this.tagsField ; }
            set { this.tagsField = value; }
        }



        /// <summary>
        /// Sets the Tags property
        /// </summary>
        /// <param name="tags">Tags property</param>
        /// <returns>this instance</returns>
        public List WithTags(Tags tags)
        {
            this.tagsField = tags;
            return this;
        }



        /// <summary>
        /// Checks if Tags property is set
        /// </summary>
        /// <returns>true if Tags property is set</returns>
        public Boolean IsSetTags()
        {
            return this.tagsField != null;
        }






        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetListId()) {
                xml.Append("<ListId>");
                xml.Append(EscapeXML(this.ListId));
                xml.Append("</ListId>");
            }
            if (IsSetListURL()) {
                xml.Append("<ListURL>");
                xml.Append(EscapeXML(this.ListURL));
                xml.Append("</ListURL>");
            }
            if (IsSetRegistryNumber()) {
                xml.Append("<RegistryNumber>");
                xml.Append(EscapeXML(this.RegistryNumber));
                xml.Append("</RegistryNumber>");
            }
            if (IsSetListName()) {
                xml.Append("<ListName>");
                xml.Append(EscapeXML(this.ListName));
                xml.Append("</ListName>");
            }
            if (IsSetListType()) {
                xml.Append("<ListType>");
                xml.Append(this.ListType);
                xml.Append("</ListType>");
            }
            if (IsSetTotalItems()) {
                xml.Append("<TotalItems>");
                xml.Append(this.TotalItems);
                xml.Append("</TotalItems>");
            }
            if (IsSetTotalPages()) {
                xml.Append("<TotalPages>");
                xml.Append(this.TotalPages);
                xml.Append("</TotalPages>");
            }
            if (IsSetDateCreated()) {
                xml.Append("<DateCreated>");
                xml.Append(EscapeXML(this.DateCreated));
                xml.Append("</DateCreated>");
            }
            if (IsSetOccasionDate()) {
                xml.Append("<OccasionDate>");
                xml.Append(EscapeXML(this.OccasionDate));
                xml.Append("</OccasionDate>");
            }
            if (IsSetCustomerName()) {
                xml.Append("<CustomerName>");
                xml.Append(EscapeXML(this.CustomerName));
                xml.Append("</CustomerName>");
            }
            if (IsSetPartnerName()) {
                xml.Append("<PartnerName>");
                xml.Append(EscapeXML(this.PartnerName));
                xml.Append("</PartnerName>");
            }
            if (IsSetAdditionalName()) {
                xml.Append("<AdditionalName>");
                xml.Append(EscapeXML(this.AdditionalName));
                xml.Append("</AdditionalName>");
            }
            if (IsSetComment()) {
                xml.Append("<Comment>");
                xml.Append(EscapeXML(this.Comment));
                xml.Append("</Comment>");
            }
            if (IsSetImage()) {
                Image  image = this.Image;
                xml.Append("<Image>");
                xml.Append(image.ToXMLFragment());
                xml.Append("</Image>");
            } 
            if (IsSetAverageRating()) {
                xml.Append("<AverageRating>");
                xml.Append(this.AverageRating);
                xml.Append("</AverageRating>");
            }
            if (IsSetTotalVotes()) {
                xml.Append("<TotalVotes>");
                xml.Append(this.TotalVotes);
                xml.Append("</TotalVotes>");
            }
            if (IsSetTotalTimesRead()) {
                xml.Append("<TotalTimesRead>");
                xml.Append(this.TotalTimesRead);
                xml.Append("</TotalTimesRead>");
            }
            if (IsSetTags()) {
                Tags  tags = this.Tags;
                xml.Append("<Tags>");
                xml.Append(tags.ToXMLFragment());
                xml.Append("</Tags>");
            } 
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}